home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / Programs / Ipswitch.IMail.Server.Pro.8.0.Winall / IMail8ec.exe / data1.cab / Web_Standard / sm_js2.cgi < prev    next >
Encoding:
Text File  |  2003-05-07  |  12.4 KB  |  358 lines

  1.   var addrbook = "<!--IMAIL.GetAddresses-->";
  2.  
  3.  
  4.     function showStatus(form)
  5.     {
  6.       if (form.status.value == 1)
  7.       {
  8.         alert("Maximum Limit exceeded for attachments, File could not be attached");
  9.         return;
  10.       }
  11.       else if ( form.status.value == 2 )
  12.       {
  13.         alert("User selected a non existent file, cannot attach file");
  14.         return;
  15.       }
  16.     }
  17.  
  18.   function applyFocus()
  19.   {
  20.      var data = document.SendMail.to.value;
  21.      if(data == ""){
  22.         document.SendMail.to.focus();
  23.         return;
  24.      }
  25.      else{
  26.         document.SendMail.textBody.focus();
  27.         return;
  28.      }
  29.   }
  30.  
  31.     function validate1(selectTitle)
  32.     {
  33.       var i, index, address, j,len,flag=0;
  34.       
  35.       i = document.SendMail.lstAddr.selectedIndex;
  36.       
  37.       if (i == -1)
  38.          return;
  39.       if ((addrbook.search('@') == -1) || document.SendMail.lstAddr.options[i].text == "" || document.SendMail.lstAddr.options[i].text == selectTitle)
  40.          return;
  41.         if (document.SendMail.to.value == "")
  42.       {
  43.         document.SendMail.to.value = document.SendMail.lstAddr.options[i].text;
  44.       }
  45.       
  46.       address = document.SendMail.to.value;
  47.       index = address.indexOf(document.SendMail.lstAddr.options[i].text, 0);
  48.       
  49.       if (index == -1)
  50.         document.SendMail.to.value = document.SendMail.to.value + ',' + ' ' + document.SendMail.lstAddr.options[i].text;
  51.       return;
  52.     } //  validate1
  53.  
  54.     function validate2(selectTitle)
  55.     {
  56.       var i, index, address, j;
  57.       
  58.       i = document.SendMail.lstAddr.selectedIndex;
  59.  
  60.       if (i == -1)
  61.          return;
  62.       if ((addrbook.search('@') == -1) || document.SendMail.lstAddr.options[i].text == "" || document.SendMail.lstAddr.options[i].text == selectTitle)
  63.          return;
  64.       if (document.SendMail.cc.value == "")
  65.       {
  66.         document.SendMail.cc.value = document.SendMail.lstAddr.options[i].text;
  67.       }
  68.  
  69.       address = document.SendMail.cc.value;
  70.       index = address.indexOf(document.SendMail.lstAddr.options[i].text, 0);
  71.  
  72.       if ( index == -1 )
  73.         document.SendMail.cc.value = document.SendMail.cc.value + ',' + ' ' + document.SendMail.lstAddr.options[i].text;
  74.         return;
  75.     } //  validate2
  76.  
  77.     function validate3(selectTitle)
  78.     {
  79.       var i, index, address, j;
  80.   
  81.       i = document.SendMail.lstAddr.selectedIndex;
  82.  
  83.       if (i == -1)
  84.         return;
  85.       if ((addrbook.search('@') == -1) || document.SendMail.lstAddr.options[i].text == "" || document.SendMail.lstAddr.options[i].text == selectTitle)
  86.          return;
  87.       if (document.SendMail.bcc.value == "")
  88.       {
  89.         document.SendMail.bcc.value = document.SendMail.lstAddr.options[i].text;
  90.       }
  91.  
  92.       address = document.SendMail.bcc.value;
  93.       index = address.indexOf(document.SendMail.lstAddr.options[i].text, 0);
  94.   
  95.       if (index == -1)
  96.         document.SendMail.bcc.value = document.SendMail.bcc.value + ',' + ' ' + document.SendMail.lstAddr.options[i].text;
  97.         return;
  98.     } //  validate3
  99.  
  100.     function valsb()
  101.     { 
  102.       var address = "";  
  103.       var sendto = ""
  104.       var sendcc = ""
  105.       var sendbcc = ""
  106.       var j=0, k, n;    
  107.      
  108.       if ((document.SendMail.to.value == "0") || (document.SendMail.to.value.length < 3))
  109.       {
  110.         alert("Destination address should be atleast 3 characters long");       
  111.         return;    
  112.       } else if (((document.SendMail.sbj.value  == "0") || (document.SendMail.sbj.value.length  <= 0)) &&
  113.                  ((document.SendMail.textBody.value == "0") || (document.SendMail.textBody.value.length <= 0)))  
  114.       {    
  115.         alert("Subject and Body both should not be blank");       
  116.         return;    
  117.       }   
  118.       <!--IMAIL.BeginAttachmentSupport-->
  119.           if (document.SendMail.userfile1.value != "")
  120.           {
  121.               alert("Please attach the selected file and then press Send");
  122.               return;
  123.         }
  124.       <!--IMAIL.EndBeginAttachmentSupport-->
  125.       document.SendMail.button.value="<!--IMAIL.SendButton-->";
  126.       document.SendMail.submit();
  127.       return;
  128.     } //  valsb
  129.  
  130.     function valsbsave()
  131.     { 
  132.       <!--IMAIL.BeginAttachmentSupport-->
  133.         if ( document.SendMail.userfile1.value != "" )
  134.         {
  135.           alert("Please attach the selected file and then press Send.  You may do so by clicking the 'Attach' link.");
  136.           return;
  137.         }
  138.       <!--IMAIL.EndBeginAttachmentSupport-->
  139.       
  140.       document.SendMail.button.value="<!--IMAIL.SaveButton-->";
  141.       
  142.       document.SendMail.submit();
  143.       return;
  144.     }
  145.  
  146.     function addattach()
  147.     {
  148.       var ch1;
  149.       
  150.       if (document.SendMail.userfile1.value == "")
  151.       {
  152.         alert("Please enter the filename of the file that you would like to attach.  You may do so by clicking the 'Browse' button.");
  153.         return;
  154.       }
  155.       
  156.       document.SendMail.button.value="<!--IMAIL.AttachButton-->";
  157.       
  158.       document.SendMail.submit();
  159.       return;
  160.     }
  161.  
  162.     function removeattach()
  163.     {
  164.       var i, length, count;
  165.       
  166.       i = document.SendMail.attachlist.selectedIndex;
  167.       
  168.       if (i == -1)
  169.       {  
  170.         alert("Please Select FileName.");
  171.         return;
  172.       }
  173.       if (document.SendMail.attachlist.options[i].text == "--No Files Attached--")
  174.       {
  175.         alert("No files are attached");
  176.         return;
  177.       }
  178.       
  179.       length = document.SendMail.attachlist.options.length;
  180.       
  181.       for(count = 0;count < length;count++)
  182.       {
  183.         if (document.SendMail.attachlist.options[count].selected == true)
  184.           document.SendMail.index.value = document.SendMail.index.value + count + ',';
  185.       }
  186.       
  187.       document.SendMail.button.value="<!--IMAIL.RemoveButton-->";
  188.       
  189.       document.SendMail.submit();
  190.       return;
  191.     }
  192.  
  193.     <!--IMAIL.BeginIfUserSpellCheckEnable-->
  194.  
  195.     function vaxSpell()
  196.     { 
  197.       var dictCheck = "<!--IMAIL.GetDictionaries-->";
  198.       if(dictCheck=="")
  199.       {
  200.         alert("Spell check is not enabled for this domain.");
  201.         return;
  202.       }
  203.       if((document.SendMail.textBody.value == "0") || (document.SendMail.textBody.value.length <= 0))
  204.       {    
  205.         alert("Message is not entered ");       
  206.         return;    
  207.       }
  208.       
  209.       document.SendMail.button.value="<!--IMAIL.SpellCheckButton-->";
  210.  
  211.  
  212.       var lex, count = 0;
  213.       i = document.SendMail.lexicons.selectedIndex;
  214.  
  215.       if(i==-1)
  216.       {
  217.         alert("Please, select a dictionary from list box.");
  218.         return;
  219.       }
  220.  
  221.       lex = document.SendMail.lexicons.options[i].text;
  222.       for( i = 0; i < document.SendMail.lexicons.length; i ++ )
  223.       {
  224.         if(document.SendMail.lexicons.options[i].selected == true)
  225.             count++;
  226.       }
  227.  
  228.       if(count>32)
  229.       {
  230.         alert("Only 32 Dictionaries are allowed to select ");
  231.         return;
  232.       }
  233.  
  234.       document.SendMail.submit();
  235.       return;
  236.     }
  237.  
  238.  
  239.    //  This function checks whether the spell checker is in use or not
  240.  
  241.     var flg_splchk = <!--IMAIL.SpellCheckerOn-->;
  242.     
  243.     function getStatusForSplChkr()
  244.     {
  245.         if(!flg_splchk)
  246.         {
  247.           document.SendMail.SpellCheckOn.value = 1;
  248.           <!--IMAIL.BeginSSL-->
  249.             <!--IMAIL.BeginIfSSLEnable-->
  250.             if(confirm("Spell Check is currently unable to transmit your message securely.  Do you wish to run Spell Check anyway?"))
  251.             {
  252.               vaxSpell();
  253.             }
  254.             <!--IMAIL.ElseBeginIfSSLEnable-->
  255.               vaxSpell();
  256.             <!--IMAIL.EndBeginIfSSLEnable-->
  257.           <!--IMAIL.ElseBeginSSL-->
  258.             vaxSpell();
  259.           <!--IMAIL.EndBeginSSL-->
  260.         }
  261.         else
  262.         {
  263.             alert("Spell checker is in use for this user.\nCannot create other instance of spell checker, please try after some time!");
  264.             flg_splchk = 0;
  265.         }
  266.     }
  267.  
  268.     function renameDict()
  269.     {
  270.       if(is_nav3)
  271.        return;  // Netscape 3.0 does not handle this operate very well
  272.  
  273.       // LABEL SP1: ADDING DICTIONARY FILENAMES TO THE LIST
  274.       // --------------------------------------------------
  275.       // To add a new dictionary to the list, simply add the filename of the dictionary as an element of
  276.       // the dictList array.  This can be done by adding another parmeter to the Array function.
  277.       // Only the filenames listed in the dictList array will be replaced with a descriptive name.
  278.       
  279.       var dictList = new Array("UserDict.tlx", "ssceam2.clx", "sscebr2.clx", "accent.tlx", "correct.tlx",
  280.                                "html.tlx", "ssceam.tlx", "sscebr.tlx", "sscela2.clx", "sscema2.clx",
  281.                              "sscepb2.clx", "sscelb2.clx", "sscemb2.clx", "ssceda2.clx", "sscedu2.clx",
  282.                              "sscefi2.clx", "sscefr2.clx", "sscege2.clx", "ssceit2.clx", "sscenb2.clx",
  283.                              "sscepo2.clx", "sscesp2.clx", "sscesw2.clx");
  284.       var dictDescript = new Array (dictList.length);
  285.      
  286.       var tempStr2;
  287.       for (var num2=0; num2 < dictList.length; num2++)
  288.       {
  289.         tempStr2=dictList[num2];
  290.         dictList[tempStr2]=num2;
  291.         dictDescript[num2] = new Array();
  292.       }
  293.  
  294.       // LABEL SP2: RENAMING THE DICTIONARY FILENAMES
  295.       // --------------------------------------------
  296.       // At this point, the elements of the dictList are being assigned to a more descriptive name.
  297.       // Note that only elements defined in the dictList array can be assigned a descriptive name.  To
  298.       // add a filename as an element of the dictList array, see LABEL SP1: ADDING DICTIONARY FILENAMES TO THE LIST.
  299.       // To assign a more descriptive name to a new element of the dictList arrary, simply follow the
  300.       // examples below by placing the filename as an argument for the dictList array with the
  301.       // dictList array as an argument for the dictDescript array.  Use the Array function to create
  302.       // a multi-dim array with one element being the descriptive name.
  303.       
  304.       dictDescript[dictList["UserDict.tlx"]] = new Array("User Defined Dictionary");
  305.       dictDescript[dictList["ssceam2.clx"]] = new Array("American English Dictionary (compressed)");
  306.       dictDescript[dictList["sscebr2.clx"]] = new Array("British English Dictionary (compressed)");
  307.       dictDescript[dictList["accent.tlx"]] = new Array("Phonetic Dictionary");
  308.       dictDescript[dictList["correct.tlx"]] = new Array("Commonly Misspelled Words");
  309.       dictDescript[dictList["html.tlx"]] = new Array("Html Dictionary");
  310.       dictDescript[dictList["ssceam.tlx"]] = new Array("American English Dictionary");
  311.       dictDescript[dictList["sscebr.tlx"]] = new Array("British English Dictionary");
  312.     dictDescript[dictList["sscela2.clx"]] = new Array("American Legal Dictionary");
  313.     dictDescript[dictList["sscema2.clx"]] = new Array("American Medical Dictionary");
  314.     dictDescript[dictList["sscepb2.clx"]] = new Array("Brazilian Portuguese Dictionary");
  315.     dictDescript[dictList["sscelb2.clx"]] = new Array("British Legal Dictionary");
  316.     dictDescript[dictList["sscemb2.clx"]] = new Array("British Medical Dictionary");
  317.     dictDescript[dictList["ssceda2.clx"]] = new Array("Danish Dictionary");
  318.     dictDescript[dictList["sscedu2.clx"]] = new Array("Dutch Dictionary");
  319.     dictDescript[dictList["sscefi2.clx"]] = new Array("Finnish Dictionary");
  320.     dictDescript[dictList["sscefr2.clx"]] = new Array("French Dictionary");
  321.     dictDescript[dictList["sscege2.clx"]] = new Array("German Dictionary");
  322.     dictDescript[dictList["ssceit2.clx"]] = new Array("Italian Dictionary");
  323.     dictDescript[dictList["sscenb2.clx"]] = new Array("Norwegian Bokmσl Dictionary");
  324.     dictDescript[dictList["sscepo2.clx"]] = new Array("Portuguese Dictionary");
  325.     dictDescript[dictList["sscesp2.clx"]] = new Array("Spanish Dictionary");
  326.     dictDescript[dictList["sscesw2.clx"]] = new Array("Swedish Dictionary");
  327.  
  328.  
  329.       
  330.       var maxlength;
  331.       maxlength = document.SendMail.lexicons.options.length;
  332.       
  333.       for(var numCount=0; numCount < maxlength; numCount++)
  334.       {
  335.         optName = document.SendMail.lexicons.options[numCount].text
  336.         for(var i=0; i < dictList.length; i++)
  337.         {
  338.           if((optName.search(dictList[i]) != -1))
  339.           {
  340.             document.SendMail.lexicons.options[numCount].text = dictDescript[i];
  341.             
  342.             // LABEL SP3: AUTOMATICALLY SELECTING A DICTIONARY FILE
  343.             // ----------------------------------------------------
  344.             // To automatically select a dictionary file, include the file's
  345.             // array index in the following IF condition's expression.  This will
  346.             // cause the dictionary to automatically be selected in the list box.
  347.             
  348.             if(i==0||i==1)
  349.             {
  350.               document.SendMail.lexicons.options[numCount].selected=1;
  351.             }
  352.             break;
  353.           }
  354.         }
  355.       }      
  356.       return;
  357.     }
  358.     <!--IMAIL.EndBeginIfUserSpellCheckEnable-->